﻿@namespace Core.Web.Admin.Blazor.Pages.Account.Settings
@using Core.FrameWork.Models

<div class="baseView">
    <div class="left" style="min-width: 310px;">
        <Spin Spinning=loading>
            <div class="right__b__1">
                <div class="avatar_title">
                    头像
                </div>
                <Avatar Size="64" Src="@AdminUser.Avatar" Icon="user" />
                <Upload Action="@UploadUrl" ShowUploadList="false" OnSingleCompleted="OnSingleCompleted">
                    <div class="button_view">
                        <Button Icon="upload">
                            更新头像
                        </Button>
                    </div>
                </Upload>
            </div>
            <Form Layout="vertical"
                  
                  Model="@AdminUser">
                <FormItem Label="账号">
                    <AntDesign.Input @bind-Value="@AdminUser.Account" />
                </FormItem>
                <FormItem Label="角色">
                    @{
                        foreach (var item in @AdminUser.Role.Split(',').ToList())
                        {
                            var random = (PresetColor)_random.Next(0, 12);
                            <Tag PresetColor="@random">@item</Tag>

                        }
                    }

                </FormItem>

                <FormItem Label="邮箱">
                    <AntDesign.Input @bind-Value="@AdminUser.Email" />
                </FormItem>
                <FormItem Label="电话">
                    <AntDesign.Input @bind-Value="@AdminUser.PhoneNumber" />
                </FormItem>
                <FormItem Label="密码">
                    <AntDesign.InputPassword @bind-Value="@AdminUser.Password" />
                </FormItem>
                <FormItem Label="真实姓名">
                    <AntDesign.Input @bind-Value="@AdminUser.TrueName" />
                </FormItem>
                <FormItem Label="地址">
                    <AntDesign.Input @bind-Value="@AdminUser.Address" />
                </FormItem>
                <FormItem Label="公司">
                    <AntDesign.Input @bind-Value="@AdminUser.Company" />
                </FormItem>
                <FormItem>
                    <Button HtmlType="submit" Type="primary" OnClick="UpdateUserInfo">
                        更新信息
                    </Button>
                </FormItem>

            </Form>
        </Spin>
    </div>
</div>